#include <iostream>
#include <chrono>

#include "Eigen"

#include "RayTracingConfig.h"
#include "Eigen"
#include "Renderer.hpp"
#include "Lambertian.hpp"
#include "Metal.hpp"
#include "Dielectric.hpp"
#include "Camera.hpp"
#include "Sphere.hpp"
#include "SphereBox.hpp"
#include "RandomScene.h"
using namespace std;

using color = Eigen::Vector3f;
using point3 = Eigen::Vector3f;

int main(int argc, char const* argv[]) {
    cout << "Version: " << RayTracing_VERSION_MAJOR << endl;
    ObjectList world = rand_scene();

    point3 lookfrom(13, 2, 3);
    point3 lookat(0, 0, 0);
    point3 vup(0, 1, 0);
    auto dist_to_focus = 10.0;
    auto aperture = 0.05;
    Camera cam(lookfrom, lookat, vup, 20, 3.f/2.f, aperture, dist_to_focus);
    // Camera cam(point3(-2, 2, 1), point3(0, 0, -1), point3(0, 1, 0), 20, 16.f / 9);
    // Camera cam(point3(0, 0, 0), point3(0, 0, -1), point3(0, 1, 0), 90, 16.f / 9);
    // Renderer r(1200, 800, 500);
    Renderer r(300, 200, 50);
    r.setDepth(5);
    r.setCamera(cam);
    time_t start = time(nullptr);
    r.multi_render(world, 10);
    time_t end = time(nullptr);
    r.save_png("out.png");
    printf("Rendering %lds\n", end - start);
    return 0;
}
